﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;
using DataAccessLayer;

namespace ServiceLayer.Entity
{
    [DataContract]
    public class ActingManagerW
    {
        int delegationID;
        string deptID;
        string startDate;
        string endDate;
        string reason;
        int employeeID;

        [DataMember]
        public int DelegationID
        {
            get { return delegationID; }
            set { delegationID = value; }
        }

        [DataMember]
        public string DeptID
        {
            get { return deptID; }
            set { deptID = value; }
        }

        [DataMember]
        public string StartDate
        {
            get { return startDate; }
            set { startDate = value; }
        }

        [DataMember]
        public string EndDate
        {
            get { return endDate; }
            set { endDate = value; }
        }

        [DataMember]
        public string Reason
        {
            get { return reason; }
            set { reason = value; }
        }

        [DataMember]
        public int EmployeeID
        {
            get { return employeeID; }
            set { employeeID = value; }
        }

        public static ActingManagerW convert(ActingManager actingManager)
        {
            ActingManagerW u = new ActingManagerW();

            u.DelegationID = actingManager.DelegationID;
            u.DeptID = actingManager.DeptID;
            u.StartDate = actingManager.StartDate.GetValueOrDefault().ToString();
            u.EndDate = actingManager.EndDate.GetValueOrDefault().ToString();
            u.Reason = actingManager.Reason;
            u.EmployeeID = actingManager.EmployeeID.GetValueOrDefault();

            return u;
        }

        public static List<ActingManagerW> convertList(List<ActingManager> list)
        {
            List<ActingManagerW> listW = new List<ActingManagerW>();

            foreach (ActingManager x in list)
            {
                listW.Add(convert(x));
            }
            return listW;
        }
    }
}